package com.itheima.health.config;

import com.itheima.health.utils.AliyunSmsProperties;
import com.itheima.health.utils.AliyunSmsUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 短信类加载
 */
@Configuration
@Slf4j
public class AliyunSmsConfiguration {

    @Bean
    public AliyunSmsUtil aliyunSmsUtil(AliyunSmsProperties aliyunSmsProperties) {
        log.info("加载阿里云短信");
        return new AliyunSmsUtil(aliyunSmsProperties.getSignName(), aliyunSmsProperties.getTemplateCode(),
                aliyunSmsProperties.getAccessKeyId(), aliyunSmsProperties.getAccessKeySecret(), aliyunSmsProperties.getEndpoint());
    }
}
